package core.tool.log.log4j;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

public class EasyLogger {
	
	public static final String LOG_TYPE_TITLE="0";
	public static final String LOG_TYPE_TWO="1";
	
	public static Logger logger=null;
	
	private static final String config="config/log4j.properties";
	
	public static void init(String rootPath) {
		System.out.println("初始化log4j...");
		PropertyConfigurator.configure(rootPath+config);
		logger=Logger.getLogger("EasyNature_Logger");
	}
	
	public static void info(String str) {
		logger.info(str);
	}
	
	public static void debug(String str) {
		logger.debug(str);
	}
	
	public static void debug(String str,String type) {
		if(LOG_TYPE_TITLE.equals(type)) {
			str="######"+str;
		}
		logger.debug(str);
	}
	public static void debug(String str,String str1,String type) {

		if(LOG_TYPE_TWO.equals(type)) {
			String newStr=str+"       "+str1;	
			logger.debug(newStr);
		}
	}
	
	public static void warn(String str) {
		logger.warn(str);
	}
	
	public static void error(String str) {
		logger.error("!!!!!!!!!!!!!!!!!!"+str);
	}

}
